package com.example.basicquestions.questions.坐标移动;

import java.util.Scanner;
import java.util.regex.Pattern;

/**
 * @author liw
 * @date 2023-03-13
 */
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] strs = scanner.nextLine().split(";");
        int[] res = new int[]{0,0};
        for(String str : strs){
            if(str.length() < 2){
                continue;
            }
            String tag = str.substring(0,1);
            String num = str.substring(1);
            if(!isInt(num)){
                continue;
            }
            int n = Integer.parseInt(num);
            switch (tag){
                case "A":
                    res[0]-=n;
                    break;
                case "D":
                    res[0]+=n;
                    break;
                case "W":
                    res[1]+=n;
                    break;
                case "S":
                    res[1]-=n;
                    break;
            }
        }
        System.out.println(res[0]+","+res[1]);
    }
    public static boolean isInt(String s){
        Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
        return pattern.matcher(s).matches();
    }
}
